import 'package:flutter/material.dart';
import 'package:mathfun/utils/app_colors.dart';

class ResultIndicator extends StatelessWidget {
  final double accuracy;

  const ResultIndicator({super.key, required this.accuracy});

  String _getMotivationText() {
    if (accuracy >= 80) return '太棒了！';
    if (accuracy >= 60) return '继续努力！';
    return '加油哦！';
  }

  Color _getAccuracyColor() {
    if (accuracy >= 80) return AppColors.success;
    if (accuracy >= 60) return AppColors.warning;
    return AppColors.error;
  }

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        Text(
          '${accuracy.toStringAsFixed(1)}%',
          style: TextStyle(
            fontSize: 72,
            fontWeight: FontWeight.bold,
            color: _getAccuracyColor(),
          ),
        ),
        const SizedBox(height: 16),
        Text(
          _getMotivationText(),
          style: TextStyle(fontSize: 24, color: Colors.grey), // 由于 AppColors.textSecondary 未定义，使用 Colors.grey 作为替代
        ),
      ],
    );
  }
}